       $(document).ready(function(){
            $(document).restFunktion('');
        });
        
        $('#submitbutton').click(function() {
            var plz = $('#plz').val();
            $(document).restFunktion(plz);
        });
        
        $.fn.restFunktion = function(plz){
            $.ajaxSetup({
                    contentType: "application/json; charset=utf-8",
                    dataType: "json"
                });
            
            var urlrest = ''
            if(plz == ''){
                urlrest = 'http://192.168.1.46:8080/volunteers/webresources/ch.ffhs.perellano.volunteers.stelleninserat'
            }else{
                urlrest = 'http://192.168.1.46:8080/volunteers/webresources/ch.ffhs.perellano.volunteers.stelleninserat/plz/' + plz
            }
            $('#result').children().remove()
            var conjson = $.getJSON(urlrest,function(daten){
                   $.each(daten, function(key, value){
                       $.each(value, function(key, value){
                            $('#result').append('<p>' +
                                'Titel: ' + value.titel + '<br />' +
                                'Name: ' + value.name + '<br />' +
                                'PLZ: ' + value.plz + '<br />' +
                                'Ort: ' + value.ort + '<br />' +
                                'Homepage: ' + '<a href="http://' + value.homepageurl + '" target="_blank">' + value.homepageurl + '</a><br />'
                                + '</p>');
                       });
                   }); 
                });
            conjson.error(function() { alert("error"); })
        };

